{% extends "base_template.html" %}
{% block main %}
<!--添加检索结果显示代码-->
       <div class="col-md-8">
            {% if search_results %}
           <h3> {{keyword|safe}}</h3>
                {% for article in search_results %}
                <div class="card mb-3">
                    <div class="card-body">
                        <h5 class="card-title">{{ article.title }}</h5>
                        <p class="card-text">作者：{{ article.username }} | 发布时间：{{ article.created_at }}</p>
                        <p class="card-text">{{ article.content|truncatechars:50|safe }}</p>
                        <a href="/blog/{{article.id}}" class="btn btn-primary">阅读更多</a>
                    </div>
                </div>
                {% endfor %}

    {% else %}
        <p>未找到与 "{{ keyword }}" 相关的博文。</p>
    {% endif %}
    </div>
{% endblock %}